#ifndef REMIND_H
#define REMIND_H

#include <QNetworkAccessManager>
#include <QWidget>
#include <iostream>
#include "json/json.h"
#include <fstream>
#include <QObject>
#include <QString>
#include <QtNetwork>
#include <QJsonObject>
#include <QJsonDocument>

struct remindmessageInfo{
    int code;
    QString data;
    QString message;
};
struct remindInfo{
    QString alias;
    int amount;
    QString date;
    int foodId;
    int fridgeId;
    int id;
    QString info;
    QString name;
    QString pic;
    QString type;
    QString unit;
    int userId;
};

class Remind : public QObject
{
    Q_OBJECT
public:
    explicit Remind(QObject *parent = nullptr);
    QNetworkAccessManager *accessManager;
    QNetworkRequest request;
    QByteArray postData;
    QNetworkReply* reply;
    remindmessageInfo r_message;
    QList<remindInfo> remindList;
    void RemindAdd(QString token,QString amount,QString date,int foodId,int fridgeId,QString remind,int userId);
    void RemindDelete(QString token,QString alias,int amount,QString date,int foodId,int fridgeId,int id,QString info,QString name,QString pic,QString type,QString unit,int userId);
    void RemindList(QString token,int filter);
    void RemindUpdate(QString token,QString alias,int amount,QString date,int foodId,int fridgeId,int id,QString info,QString name,QString pic,QString type,QString unit,int userId);
private slots:
    void finishedSlot(QNetworkReply *reply);
signals:
    void RemindAddSuccess();
    void RemindDeleteSuccess();
    void RemindListSuccess();
    void RemindUpdateSuccess();
};

#endif // REMIND_H
